import pkg from '@system.package'

export default function(pkgName) {
  return new Promise((resolve, reject) => {
    pkg.hasInstalled({
      package: pkgName,
      success({ result }) {
        if (result) {
          resolve()
        } else {
          reject()
        }
      },
      fail(e) {
        console.error(e)
        reject()
      }
    })
  })
}
